<template>
  <a-modal
    :title="`定时器${title}`"
    :width="640"
    destroyOnClose
    :visible="visible"
    :confirmLoading="loading"
    @ok="handleSubmit"
    @cancel="visible=!visible"
  >
    <a-spin :spinning="loading">
      <a-form :form="form">
        <a-form-item
          label="定时器名称"
          :labelCol="labelCol"
          :wrapperCol="wrapperCol"
        >
          <a-input v-decorator="['quartzName', {initialValue: editForm.quartzName,rules: rules.quartzName}]"/>
        </a-form-item>

        <a-form-item
          label="cron表达式"
          :labelCol="labelCol"
          :wrapperCol="wrapperCol"
        >
          <a-input v-decorator="['cron', {initialValue: editForm.cron,rules: rules.cron}]"/>
        </a-form-item>


        <a-form-item
          label="定时器描述"
          :labelCol="labelCol"
          :wrapperCol="wrapperCol"
        >
          <a-textarea :row="3" v-decorator="['quartzDesc', {initialValue: editForm.quartzDesc,rules: rules.quartzDesc}]"/>
        </a-form-item>


      </a-form>
    </a-spin>
  </a-modal>
</template>

<script>

  const rules = {
    quartzName: [
      { required: true, message: '定时器名称不能空！' },
    ],
    cron: [
      { required: true, message: 'cron表达式不能空！' },
    ],
  }

  import saveMixins from '../../../../common/mixins/saveMixins'
  import {saveQuartz} from '../../../../api/base/quartz'

  export default {
    name: 'save',
    data() {
      return {
        rules: rules,
        roles:[]
      }
    },
    mixins: [saveMixins],
    created(){
    },
    methods:{
      commit(values){
        return saveQuartz(values);
      }
    }
  }
</script>

<style scoped>

</style>